<?php  
//mssql数据库设置
//error_reporting(0);
$conInfo=array('Database'=>'DBNAME', 'UID'=>'sa', 'PWD'=>'sa');
$server='SQL SERVER IP 地址';
$conn=sqlsrv_connect($server, $conInfo);
$hy_vip = $_POST['hy_vip']; // 接受传递过来的用户名  
$rs=sqlsrv_query($conn, "select CardCode from [9002].TBCARD where CardCode='".$hy_vip."'"); 
if($rs === false){  
        die(print_r(sqlsrv_errors(), true)); 
echo '<font color="red">抱歉，'. $hy_vip .'卡号无效！</font>';  		
    }  
    if($row = sqlsrv_fetch_array($rs, SQLSRV_FETCH_ASSOC)){  
       echo '<font color="green">恭喜，'. $hy_vip.'可以绑定！</font>';  
    }  else
	{echo '<font color="red">抱歉，'. $hy_vip .'卡号不存在！</font>';  }

?>  